wayland: Don't "probe" for a Wayland compositor if started from compositor
authorRob Bradford <rob@linux.intel.com>
Fri, 12 Apr 2013 17:39:20 +0000 (18:39 +0100)
committerRob Bradford <rob@linux.intel.com>
Fri, 12 Apr 2013 17:43:36 +0000 (18:43 +0100)
In the case that the client is started directly by the compositor the
WAYLAND_SOCKET environment variable is set containing the fd to use that was
created by a socketpair.

This environment variable is consumed by a call to wl_display_connect so a
second call will not take advantage of it.

https://bugzilla.gnome.org/show_bug.cgi?id=697673

gdk/wayland/gdkdisplaymanager-wayland.c

index 5d4e12beabe57e4b319ace5b08d9ed6e68aaefb7..0d73a783646f8ca33d4959ac2da00fb158a4e66c 100644 (file)
@@ -59,6 +59,12 @@ gdk_wayland_display_manager_initable_init (GInitable     *initable,
 {
   struct wl_display *wl_display;
 
+  /* Set by the compositor when launching a special client - and it gets reset
+   * by wl_display_connect so we must avoid calling it twice
+   */
+  if (g_getenv ("WAYLAND_SOCKET"))
+    return TRUE;
+
   /* check that a connection to the default display is possible */
   wl_display = wl_display_connect (gdk_get_display_arg_name ());